<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件通信（父传子，子传父）</title>
</head>
<body>
    <div id="app">
        <father></father>
    </div>
    <script src="../day02/lib/vue.global.js"></script>
    <script>
        // 父组件选项
        const faterOptions = {
            template:`
            <div class="father">
                <div>这是父组件中的内容</div>
                <hr/>
                
                <son username="admin" password="123456"></son>
                </div>`
                ,
                data(){
                    return{
                        message:"fater",
                    }
                } ,   
        
        }
        // 子组件选项
        const sonOptions ={
            template:`
                <div class="son">
                    <div>这是子组件中的内容</div>
                    <div>{{username}},{{password}}</div>
                </div>
            `,
            props:["username","password"], //声明可接收属性的名称信息
        }




        const app =Vue.createApp({})
        //全局注册组件
        app.component("father",faterOptions)
        app.component("son",sonOptions)
        app.mount("#app")
    </script>
</body>
</html>